package com.yzy.fly.entity.role;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yzy.fly.kernel.model.FlyBasicModel;
import com.yzy.fly.util.DateUtil;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

@Data
@TableName(value = "fly_service_method", autoResultMap = true)
public class FlyServiceMethod extends FlyBasicModel<Integer,FlyServiceMethod> {

    @TableId(type = IdType.AUTO)
    private Integer id;
    private Integer seq;
    private String label;
    private String name;
    private String type;
//    @ParentId
    private Integer parentId;
    private Integer componentId;
    private Integer systemId;

    private String descr;

    @TableField(value = "params",typeHandler = FastjsonTypeHandler.class)
    private JSONArray params = new JSONArray();
    @TableField(value = "result",typeHandler = FastjsonTypeHandler.class)
    private JSONArray result = new JSONArray();
    @TableField(exist=false)
    private List<FlyRequestMapping> requestMappings;

    @DateTimeFormat(pattern= DateUtil.DateFormatPattern.yyyy_MM_dd_HH_mm_ss)
    @JsonFormat( pattern = DateUtil.DateFormatPattern.yyyy_MM_dd_HH_mm_ss )
    private Date createTime;
    @DateTimeFormat(pattern= DateUtil.DateFormatPattern.yyyy_MM_dd_HH_mm_ss)
    @JsonFormat( pattern = DateUtil.DateFormatPattern.yyyy_MM_dd_HH_mm_ss )
    private Date updateTime;

}
